#ifndef _EDITPAGE_H
#define _EDITPAGE_H

#include <amanita/aString.h>
#include <amanita/sqlite/aRecord.h>
#include "Main.h"
#include "Page.h"
#include "occult/Occult.h"


class EditPage : public Page {
private:
	struct {
		GtkWidget *editor;
		//GdkFont *font;
		GtkTextBuffer *buffer;
//		GtkTextIter iter;
	} gtk;

	symbol_t symbol;
	uint64_t id;

	static void save_callback(GtkWidget *widget,gpointer data);
	static void find_callback(GtkWidget *widget,gpointer data);
	static void findreplace_callback(GtkWidget *widget,gpointer data);
	static void undo_callback(GtkWidget *widget,gpointer data);
	static void redo_callback(GtkWidget *widget,gpointer data);
	static void help_callback(GtkWidget *widget,gpointer data);

	void init(symbol_t s,uint64_t i);
	void setText(const char *txt);

public:
	EditPage(const char *uri);
	EditPage(symbol_t s,uint64_t id=0);
	~EditPage();

	void setText(symbol_t s,uint64_t id=0);
	void saveText();
};


#endif /* _EDITPAGE_H */

